package course.filter;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.List;
import java.util.Map;

//@WebListener  //不能加这个
public class ExcelListener<T> extends AnalysisEventListener<T> {
    List<T> list;


    public ExcelListener(List<T> t) {
        this.list = t;
    }

    /**
     * 读取表头内容
     * @param headMap
     * @param context
     */
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println("表头："+headMap);
    }

    @Override
    public void invoke(T t, AnalysisContext analysisContext) {
        list.add(t);
    }

    /**
     * 读取完成之后
     * @param analysisContext
     */
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) { }
}
